﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shop.Master" AutoEventWireup="true" CodeBehind="Register.aspx.cs" Inherits="ShopNet.Register" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">
    function ColocaEstilo() {
        var login = $("#UserName").val().replace(" ", "");
        if (login.length == 0 && !$("#UserName").hasClass("error")) {
            $("#UserName").addClass("error");
        }
        var pass = $("#Password").val().replace(" ", "");
        if (pass.length == 0 && !$("#Password").hasClass("error")) {
            $("#Password").addClass("error");
        }
        var email = $("#Email").val().replace(" ", "");
        if (email.length == 0 && !$("#Email").hasClass("error")) {
            $("#Email").addClass("error");
        }

        var confirmPassword = $("#ConfirmPassword").val().replace(" ", "");
        if (confirmPassword.length == 0 && !$("#ConfirmPassword").hasClass("error")) {
            $("#ConfirmPassword").addClass("error");
        }

        if (pass != confirmPassword) {
            if (!$("#ConfirmPassword").hasClass("error")) {
                $("#ConfirmPassword").addClass("error");
            }
            if (!$("#Password").hasClass("error")) {
                $("#Password").addClass("error");
            }
        }
        
        return true;
    }
</script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="main" runat="server">
<div id="content_top"></div>
<div id="content_middle">
    <asp:CreateUserWizard ID="RegisterUser" runat="server" EnableViewState="false" OnCreatedUser="RegisterUser_CreatedUser">
        <LayoutTemplate>
            <asp:PlaceHolder ID="wizardStepPlaceholder" runat="server"></asp:PlaceHolder>
            <asp:PlaceHolder ID="navigationPlaceholder" runat="server"></asp:PlaceHolder>
        </LayoutTemplate>
        <WizardSteps>
            <asp:CreateUserWizardStep ID="RegisterUserWizardStep" runat="server">
                <ContentTemplate>
                    <h3>
                        Criar Novo Usuário
                    </h3>
                    <p>&nbsp;</p>
                    <p>
                        Senhas ão obrigatórias e evem possuir no mínimo: <%= Membership.MinRequiredPasswordLength %> caracteres.
                    </p>
                    <p>&nbsp;</p>
                    <p>
                        <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Login:</asp:Label>
                        <asp:TextBox ID="UserName" runat="server" CssClass="input_field_simple" ClientIDMode="Static"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" 
                                CssClass="failureNotification" ErrorMessage="Login é Obrigatório." ToolTip="Login é Obrigatório." 
                                ValidationGroup="lLogin" Display="None">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
                        <asp:TextBox ID="Email" runat="server" CssClass="input_field_simple" ClientIDMode="Static"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email" 
                                CssClass="failureNotification" ErrorMessage="E-mail é Obrigatório." ToolTip="E-mail é Obrigatório." 
                                ValidationGroup="lLogin" Display="None">*</asp:RequiredFieldValidator>
                        
                    </p>
                    <p>
                        <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Senha:</asp:Label>
                        <asp:TextBox ID="Password" runat="server" CssClass="input_field_simple" ClientIDMode="Static" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" 
                                CssClass="failureNotification" ErrorMessage="Senha é Obrigatória." ToolTip="Senha é Obrigatória." Display="None"
                                ValidationGroup="lLogin">*</asp:RequiredFieldValidator>
                    </p>
                    <p>
                        <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">Confirmação Senha:</asp:Label>
                        <asp:TextBox ID="ConfirmPassword" runat="server" CssClass="input_field_simple" ClientIDMode="Static" TextMode="Password"></asp:TextBox>
                        <asp:RequiredFieldValidator ControlToValidate="ConfirmPassword" CssClass="failureNotification" Display="None" 
                                ErrorMessage="Confirmação de Senha é Obrigatória." ID="ConfirmPasswordRequired" runat="server" 
                                ToolTip="Confirmação de Senha é Obrigatória." ValidationGroup="lLogin">*</asp:RequiredFieldValidator>
                        <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword" 
                                CssClass="failureNotification" Display="None" ErrorMessage="A senha e a confirmação devem ser iguais."
                                ValidationGroup="lLogin">*</asp:CompareValidator>
                    </p>
                       
                    

                    <p class="submitButton">
                        <asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="Registrar" ClientIDMode="Static" CssClass="submit_btn" OnClientClick="return ColocaEstilo();"
                                ValidationGroup="lLogin"/>
                    </p>
                    
                </ContentTemplate>
                <CustomNavigationTemplate>
                </CustomNavigationTemplate>
            </asp:CreateUserWizardStep>
        </WizardSteps>
    </asp:CreateUserWizard>
</div>
<div id="content_bottom"></div>
</asp:Content>
